package com.aaa.service.impl;

import com.aaa.dao.PayMoneyDao;
import com.aaa.pojo.PayMoney;
import com.aaa.service.PayMoneyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class PayMoneyServiceImpl implements PayMoneyService {
    @Autowired
    private PayMoneyDao payMoneyDao;
    @Override
    public List<PayMoney> selectPayMoney() {
        return payMoneyDao.selectPayMoney();
    }

    @Override
    public PayMoney selectByPid(Integer pid) {
        return payMoneyDao.selectByPid(pid);
    }

    @Override
    public PageInfo<PayMoney> getPayByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//这行是重点，表示从pageNum页开始，每页pageSize条数据
        List<PayMoney> list = payMoneyDao.selectPayMoney();
        PageInfo<PayMoney> pageInfo = new PageInfo<PayMoney>(list);
        return pageInfo;
    }

    @Override
    public Boolean addPayMoney(Integer u_id, Integer pay_id,Double amount) {
        return payMoneyDao.addPayMoney(u_id, pay_id,amount);
    }

    @Override
    public void addRecordMoney(Double amount, String pro_type) {
        payMoneyDao.addRecordMoney(amount, pro_type);
    }
}
